<template>
  <div>
    <div class="panel wrapper">
      <h3>智能资讯</h3>
      <form class="form-inline" :inline="true" :model="pdata" >
        <div class="form-group">
          <label class="font-bold">关键字</label>
          <input type="text" class="form-control" name="strkeyword" v-model="pdata.strkeyword" placeholder="请输入关键字" required>
        </div>
        <el-button class="form-control btn m-b-xs btn-sm btn-info" v-disabled="vc.submitting" @click="btn_run(pdata.strkeyword);">
          <span v-show="!vc.submitting" >搜索</span>
          <span v-show="vc.submitting" >搜索中...</span>
        </el-button>
      </form>

      <code class="search-hyperlink" @click="btn_run('全部');">全部</code>
      <code class="search-hyperlink" @click="btn_run('中国银河');">中国银河</code>
      <code class="search-hyperlink" @click="btn_run('科大讯飞');">科大讯飞</code>
      <code class="search-hyperlink" @click="btn_run('贵州茅台');">贵州茅台</code>
      <code class="search-hyperlink" @click="btn_run('腾讯控股');">腾讯控股</code>
      <code class="search-hyperlink" @click="btn_run('中国平安');">中国平安</code>
      <code class="search-hyperlink" @click="btn_run('宁波银行');">宁波银行</code>
      <code class="search-hyperlink" @click="btn_run('华大基金');">华大基金</code>
      <code class="search-hyperlink" @click="btn_run('格力电器');">格力电器</code>
      <div class="list-group clear ng-hide" >
        <span class="text-danger"><b class="ng-binding"></b></span>
      </div>
    </div>

    <div v-show="pdata.results" v-for="d in pdata.results" class="panel wrapper">
        <h2 class="search-contentitem-title">
          <router-link :to="`/zx/detail/${d._id}`">
            {{d._source.title}}
          </router-link>
        </h2>
        <span class="search-contentitem-richtext">
          <router-link :to="`detail/${d._id}`">
            <p class="ng-binding">
              {{d._source.description}}
            </p>
          </router-link>
        </span>
        <el-row >
          <el-col :span="10">时间:{{d._source.time}}</el-col>
          <el-col :span="10">作者:{{d._source.author}}</el-col>
        </el-row >
    </div>

  </div>



</template>

<script>
//import {
//  list
//} from 'api/ai/zx/index';
import { list } from '@/api/zx'

  export default {
    data: function(){
      return {
         pdata: {
           strkeyword: '中国银河',
           results: []
         },
         vc: {
           submitting: false
         },
       }
    },
    computed: {
      /*v
        data(){
            const self = this;
            return self.tableData;
          }
          */
    },
    methods: {
      btn_run(keys) {
        console.log('submit!',keys);
        let self = this;
        if (keys == undefined){

        }
        else {
          self.pdata.strkeyword = keys;
        }
        var qdata = {
                      //SRVC_ID:"9954",
                      SRVC_ID: "90101010",
                      keyword:self.pdata.strkeyword
                    };
        list(qdata).then(response => {
          self.pdata.results = response;
          console.log(self.pdata.results)
        })

      }

    }
  }
</script>

<style scoped>
.t-bk-clr {
  // background-color: #F1F1F1;
}
.t-plane-description {
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid transparent;
    border-radius: 4px;
    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
  /*
    padding: 20px;
    box-sizing: border-box;
    border: 1px solid #ebebeb;
    border-radius: 3px;
    font-size: 14px;
    line-height: 22px;
    color: #666;
    word-break: break-word;
    margin: 10px;
    background-color: #fff;
  */
}

.search-hyperlink:visited {
    color: #005999;
}
.search-hyperlink:hover, .search-hyperlink:active {
    color: #3af;
}

.search-hyperlink {
    color: #07C;
    line-height: 1.3;
    margin-bottom: 0.1em;
    font-size: 12px;
    font-weight: 300;
}

.search-contentitem-title {
    font-size: 18px;
    font-weight: 600;
    font-synthesis: style;
    line-height: 1.6;
    color: #1e1e1e;
    margin-top: -4px;
    margin-bottom: -4px;
}

.search-contentitem-richtext {
    max-height: 100px;
    margin-top: 9px;
    margin-bottom: -4px;
    overflow: hidden;
    cursor: pointer;
    -webkit-transition: color .14s ease-out;
    transition: color .14s ease-out;
    font-size: inherit;
    font-weight: 400;
    font-style: normal;
    white-space: normal;
    pointer-events: none;
    word-break: break-word;
    //white-space: pre-wrap;
    //line-height: 1.67;
}
.search-contentitem-bottom {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    //-ms-flex-align: center;
    //align-items: center;
    //height: 52px;
    //padding: 0 20px;
    //margin: 4px -20px -8px;
    background: #fff;
    clear: both;
    //float: right;
}
.search-contentitem-bottomtext {
  color: #8590a6;
  font-size: 14px;
  //text-align: right;
  //align: right;
  //float: right;
}

</style>
